var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_VideoBuyOne_UIBindings = require("AA_UI_VideoBuyOne_UIBindings");
var UIView = require("AA_UIView");
var Const_Game = require("AA_Const_Game");
var BundleConfig = require("AA_BundleConfig");
var ADManager = require("AA_ADManager");
var AIControl = require("AA_AIControl");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var GameDataManager = require("AA_GameDataManager");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_VideoBuyOne = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    var t = this;
    this.openData = e;
    var o = this.auto_ui;
    o.txt_titleLabel.string = e.titleStr;
    o.txt_infoLabel.string = e.infoStr;
    o.node_type.children[1].active = e.coinCount > 0;
    o.node_type.children[2].active = 0 == e.coinCount;
    if (e.coinCount > 0) {
      this.auto_ui.txt_countLabel.string = "" + e.coinCount;
    } else {
      this.auto_ui.node_type.children[2].destroyAllChildren();
      var n = 1;
      switch (e.pfbName) {
        case Const_Game.FruitPfbName.gezi:
        case Const_Game.FruitPfbName.heng2:
          n = 1;
          break;
        default:
          n = .5;
      }
      this.auto_ui.sp_furitIconSprite.node.scale = n;
      this._loadRes(BundleConfig.BundleNames.Game, "game/" + "item/qiPao_" + e.pfbName, cc.Prefab).then(function (e) {
        var o = cc.instantiate(e);
        o.children[0].active = true;
        t.auto_ui.node_type.children[2].addChild(o);
        t.auto_ui.node_type.children[2].scale = n;
        o.setPosition(0, 0);
      });
      this.auto_ui.sp_furitIconSprite.spriteFrame = null;
      e.furidSprite && (this.auto_ui.sp_furitIconSprite.spriteFrame = e.furidSprite);
    }
    AIControl.default._instance.isOpen && AIControl.default._instance.ShowClickBtn(this.auto_ui.btn_clickBtn.node, function () {
      t.openData.clickCallBack && t.openData.clickCallBack();
      t._close();
    });
  };
  _creator.prototype._clickListener = function (e) {
    var t = this;
    switch (e) {
      case this.auto_ui.btn_closeBtn:
        this.openData.failCallBack && this.openData.failCallBack();
        this._close();
        break;
      case this.auto_ui.btn_clickBtn:
        var o = this.openData.titleStr;
        if (1 == GameGlobalVariable.GameGlobalVariable.isTeShuLevel()) {
          o = "无尽模式" + o;
        } else {
          var n = GameDataManager.GameDataMgr.getNowLevelBoshuState(GameGlobalVariable.GameGlobalVariable.nowlevel, 2) + 1;
          o = GameGlobalVariable.GameGlobalVariable.nowlevel + "章_" + n + "波_" + o;
        }
        ADManager.ADMgr.showRewardedVideo(o, function () {
          t.openData.clickCallBack && t.openData.clickCallBack();
          t._close();
        });
    }
  };
  __decorate([_property(UI_VideoBuyOne_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_VideoBuyOne;